<?php
/*
 * 
 * 图片处理
 */
 
class images{
	
	function __construct(){
		
	}
	
	function resize($src,$des=0,$here=0,$cut=0,$width=100,$height=80){
		$image = imagecreatefromjpeg($src);
		$m = getimagesize($src);
		$w = $m[0];
		$h = $m[1];
        //固定宽度
        $wid = $width;
        $hei = $h*($width/$w);
		$new_image = imagecreatetruecolor($wid, $hei);
		imagecopyresized($new_image, $image, 0, 0, 0, 0, $wid, $hei, $w, $h);
		if($des== 0){
			$fileinfo = str_replace(basename($src), 'thumb_'.basename($src), $src);
		}else{
			$fileinfo = $des.'/'.basename($src);
		}
		imagejpeg($new_image, $fileinfo);
		imagedestroy($image);
		imagedestroy($new_image);
		return $fileinfo;
	}
	
	/*
	 * 初始化,新图片..
	 */
	function initialize(){
		
	}
}
/*
$img = new images();
$img->resize('d:\00010102.jpg'); 
 * */
?>